import { UC } from '@/api/config/servicePort'
import { ResPage } from '@/api/interface'
import { Theme } from './interface'
import http from '@/api'

// 主题列表
export function pageTheme(query: Theme.Query) {
  return http.get<ResPage<Theme.Record>>(UC + `/theme/page`, query)
}

// 主题详情
export const getTheme = (id: string) => {
  return http.get<Partial<Theme.Form>>(UC + `/theme`, { id }, { loading: false })
}

// 新增主题
export const addTheme = (form: Partial<Theme.Form>) => {
  return http.post(UC + `/theme`, form)
}

// 修改主题
export const updateTheme = (form: Partial<Theme.Form>) => {
  return http.put(UC + `/theme`, form)
}

// 删除主题
export const removeTheme = (id: string) => {
  return http.delete(UC + `/theme`, { id })
}
